<%@ page import="org.springframework.core.io.Resource" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.io.ByteArrayOutputStream" %>
<%@ page import="org.springframework.web.context.support.ServletContextResource" %><%--
  Created by IntelliJ IDEA.
  User: junrui.wang
  Date: 2018/4/18
  Time: 17:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>测试ServletContextResource</title>
</head>
<body>
    <%
        Resource res3 = new ServletContextResource(application, "WEB-INF/conf/file.txt");
        InputStream in3 = res3.getInputStream();
        ByteArrayOutputStream baos3 = new ByteArrayOutputStream();
        int i = 0;
        while((i=in3.read()) != -1){
            baos3.write(i);
        }
    %>
    <input type="text" value="<%=res3.getFilename()%>">
    <input type="text" value="<%=baos3.toString()%>">
</body>
</html>
